import instance from '../request/request'
import qs from 'qs'
// 登录
export const Login = (params) => instance.post('/user/login',qs.stringify(params))
// 获取用户详细信息
export const UserInfo =() => instance.get('/info/showInfo')
// 修改背景图片
export const ChangeBg=(params)=>instance.post('/info/uploadBackImg',params)
// 修改头像
export const ChangeAvatar=(params)=>instance.post('/info/uploadAvator',params)
// 修改详细信息
export const ChangeUserDetail=(params)=>instance.post('/info/updateInfo',qs.stringify(params))
// 根据userid获取userinfo
export const GetUserInfo=(params)=>instance.post('/info/getUserInfoById',qs.stringify(params))
// 修改密码
export const ChangePwd=(params)=>instance.post('/user/updatePassword',qs.stringify(params))
// 注册
export const Register =(params)=>instance.post('/user/register',qs.stringify(params))
// 退出登录
export const Logout =() => instance.get('/user/logout')
// 获得渔具信息
export const GetGearInfo = () => instance.get('/gear/info')
// 添加渔具信息
export const AddGearInfo = (params) => instance.post('/gear/add',qs.stringify(params))
// 删除渔具
export const DeleteGearInfo = (gearid) => instance.post('/gear/delete',qs.stringify({gearid:gearid}))
// 修改渔具信息
export const UpdateGearInfo = (params) => instance.post('/gear/update',qs.stringify(params))
// 发布blog
export const AddBlog = (params) => instance.post('/blog/addBlog',params,{
    headers: {
        'Content-Type': 'multipart/form-data;charset=UTF-8'
    }
})
// 获取全部私人blog
export const GetOwnBlog = () => instance.get('/blog/getOwnBlog')
// 获取全部blog用于首页展示
export const GetAllBlog = (params)=>instance.post('/blog/home',qs.stringify(params))
// 分页获取私人blog
export const GetOwnBlogByPage = (params) => instance.post('/blog/page',qs.stringify(params))
// 分页获取blog
export const GetAllBlogByPage = (params) => instance.post('/blog/homePage',qs.stringify(params))
// 根据blogid获取博客内容
export const GetBlogById = (params) => instance.post('/blog/blogById',qs.stringify(params))
// 博客的点赞和不同意
export const BlogAgree = (agreeParams) => instance.post('/blog/agree',qs.stringify(agreeParams))
export const BlogDisagree = (params) => instance.post('/blog/disagree',qs.stringify(params))
export const BlogDeAgree = (agreeParams) => instance.post('/blog/deagree',qs.stringify(agreeParams))
export const BlogDeDisagree = (params) => instance.post('/blog/dedisagree',qs.stringify(params))

// 删除单条blog
export const DeleteBlog = (params) => instance.post('/blog/deleteBlog',qs.stringify(params))

// 评论信息的获取
export const GetCommentByBlogId = (params) => instance.post('/comment/list',qs.stringify(params))
// 一级评论的发布
export const AddCommentOne = (params) => instance.post('/comment/publish',qs.stringify(params))
// 二级评论的发布
export const AddCommentTwo = (params) => instance.post('/comment/publishTwo',qs.stringify(params))
// 用户个人主页中comment的获取
export const GetCommentByUserId = (params) => instance.post('/comment/detailComment',qs.stringify(params))
// 删除comment
export const DeleteCommentById = (params) => instance.post('/comment/deleteByCommentId',qs.stringify(params))
// 喜欢页面
export const IsLiked = (params) => instance.post('/likeInfo/isLiked',qs.stringify(params))
export const LikePage = (params) => instance.post('/likeInfo/save',qs.stringify(params))
export const DeleteLike = (params) => instance.post('/likeInfo/delete',qs.stringify(params))
export const GetAllLike = () => instance.get('/likeInfo/getAll')

// 高手秘籍的发布
export const PublishSecret = (params) => instance.post('/secret/publish',qs.stringify(params))
// 分页查询高手秘籍
export const GetSecretByPage = (params) => instance.post('/secret/page',qs.stringify(params))
// search的模糊查询
export const SearchSecret = (params) => instance.post('/secret/search',qs.stringify(params))
// 点赞
export const IsLikedSecret = (params) => instance.post('/secret/agree',qs.stringify(params))
export const IsDislikeSecret = (params) => instance.post('/secret/disagree',qs.stringify(params))
export const CancelIsLikedSecret = (params) => instance.post('/secret/cancelagree',qs.stringify(params))
export const CancelIsDislikeSecret = (params) => instance.post('/secret/canceldisagree',qs.stringify(params))
// 秘籍详情页
export const GetSecretDetail = (params)=>instance.post('/secret/detail',qs.stringify(params))
// 秘籍收藏
export const CollectSecret = (params) => instance.post('/collection/save',qs.stringify(params))
// 取消收藏
export const CancelCollectSecret = (params) => instance.post('/collection/cancel',qs.stringify(params))
// 查看是否收藏过
export const IsCollectedSecret = (params) => instance.post('/collection/check',qs.stringify(params))
// 获取个人收藏
export const GetOwnCollection = ()=>instance.get('/collection/getOwn')
export const GetOwnCollectionByPage = (params) => instance.post('/collection/getOwnPage',qs.stringify(params))
// 活动页
export const GetEventListByPage = (params) => instance.post('/event/getAllPage',qs.stringify(params))
// 条件查询
export const GetByState = (params) => instance.post('/event/state',qs.stringify(params))

// 个人信息页的event展示
export const GetEventByUserId = (params) => instance.post('/event/launch',qs.stringify(params))
// 根据eventid查询对应 的event信息
export const GetEventInfo = (params) => instance.post('/event/getByid',qs.stringify(params))
// 发布活动
export const HoldEvent = (params) => instance.post('/event/hold',params)

// 删除自己举办的活动
export const DeleteOwn = (params)=> instance.post('/event/delete/own',qs.stringify(params))
// 报名活动
export const SignInEvent = (params)=> instance.post('/event/sign',qs.stringify(params))
// 判断是否报名过
export const IsSigned = (params) => instance.post('/event/isSigned',qs.stringify(params))

// 取消报名
export const CancelSign = (params) => instance.post('/event/cancel/sign',qs.stringify(params))
// 取消活动
export const CancelEvent = (params) => instance.post('/event/cancelEvent',qs.stringify(params))


// 参与比赛   ---->参与下次评选
export const SignInCompetition = (params) => instance.post('/race/add',params)
// 获取比赛剩余时间
export const GetTime = ()=>instance.get('/race/schedule')

// 获取正在参与评选的race item
export const GetRaceItem = (params) => instance.post('/race/getSelection',qs.stringify(params))
// 下一届参与的 race item
export const GetNextRaceItem = (params) => instance.post('/race/getNextSelection',qs.stringify(params))

// 判断是否投过票
export const IsVoted = (params) => instance.post('/race/isRaced',qs.stringify(params))
// 投票
export const Vote = (params) => instance.post('/race/vote',qs.stringify(params))

// 获取总票数
export const GetVoteCount=()=>instance.get('/race/getVoteCount')
// 得到top3
export const GetTop3=()=>instance.get('/race/getTop3')

// 得到秘籍页面 作者信息
export const GetAuthorInfo=(params)=>instance.post('/little/author',qs.stringify(params))

// 得到排名前五的秘籍用于展示
export const GetTop5=()=>instance.get('/secret/getTitle')
// 得到消息记录
export const GetMessageHistory=(params)=>instance.post('/chat/history',qs.stringify(params))
// 得到历史联系人
export const GetContacts=()=>instance.get('/chat/users')

// ----------------------------------------------------------------------------------------------

// admin登录
export const AdminLogin = (params) => instance.post('/admin/login',qs.stringify(params))
// 总人数
export const TotalUser = () => instance.get('/admin/total')
// 省份人数
export const ProvinceUser = () => instance.get('/admin/provence')
// user搜索
export const SearchUser = (params) => instance.post('/admin/info',qs.stringify(params))
// 用户删除
export const DeleteUser = (params) => instance.post('/admin/del',qs.stringify(params))
// blog获取 -- 点赞
export const BlogGetAgree = (params) => instance.post('/admin/blog',qs.stringify(params))
// blog获取 -- 时间
export const BlogGetTime = (params) => instance.post('/admin/blogtime',qs.stringify(params))
// blog获取  -- 查询
export const BlogGetSearch = (params) => instance.post('/admin/bloglike',qs.stringify(params))
// blog删除
export const BlogDelete = (params) => instance.post('/admin/blog/delete',qs.stringify(params))


// secret获取
export const SecretGet = (params) =>instance.post('/admin/secret',qs.stringify(params))
// secret search -- type
export const SecretSearchType = (params) =>instance.post('/admin/secret/type',qs.stringify(params))
// secret search --keyword
export const SecretSearchKeyword = (params) =>instance.post('/admin/secret/keyword',qs.stringify(params))
// secret删除
export const SecretDelete = (params) =>instance.post('/admin/secret/delete',qs.stringify(params))


// promotion操作
export const PromotionGet = (params) =>instance.post('/admin/promotion/get',qs.stringify(params))
export const PromotionAdd = (params) =>instance.post('/admin/promotion/save',qs.stringify(params))
export const PromotionUpdate = (params) =>instance.post('/admin/promotion/update',qs.stringify(params))
export const PromotionDelete = (params) =>instance.post('/admin/promotion/delete',qs.stringify(params))
export const PromotionSearch = () =>instance.get('/admin/promotion/getShow')

export const PromotionGetShow = (id) =>instance.get(`/admin/promotion/${id}`,)